mp2 / Apache byterange filter

mp2 / Apache byterange filter

am 18.06.2009 16:22:46 von Adriano Caloiaro

--001636283644799f4b046ca02579
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello,

Could someone point me in the correct direction to support byte range
responses in mod_perl2? From what I've read, Apache should understand that
it needs to apply the byterange filter whenever $r->sendfile is used on a
large file and the Range: header is present in the incoming request.
However what I'm seeing is that the entire file is returned for each byte
range requested by the client.

Access log serving off disk in Apache2:

*.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 206 1 "-" "-"
*.*.*.* - - [17/Jun/2009:19:50:31 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 206 435996 "-" "-"
*.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 206 2097152 "-" "-"

Serving from perl handler:

*.*.*.* - - [18/Jun/2009:10:11:43 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 200 2533148 "-" "-"
*.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 200 2533148 "-" "-"
*.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew17.flv
HTTP/1.1" 200 2533148 "-" "-"


It would seem like re-invited in the wheel if I were to implement RFC 2616
in perl when there is a byterange filter already present in apache. Thank
you for any help!

-Adrian

--001636283644799f4b046ca02579
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,

Could someone point me in the correct direction to support by=
te range responses in mod_perl2?=A0 From what I've read, Apache should =
understand that it needs to apply the byterange filter whenever $r->send=
file is used on a large file and the Range: header is present in the incomi=
ng request.=A0 However what I'm seeing is that the entire file is retur=
ned for each byte range requested by the client.=A0



Access log serving off disk in Apache2:

*.*.*.* - - [17/Jun/2009=
:19:50:30 -0400] "GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 20=
6 1 "-" "-"
*.*.*.* - - [17/Jun/2009:19:50:31 -0400]=
"GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 435996 "-=
" "-"


*.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 206 2097152 "-" "-"

Servin=
g from perl handler:

*.*.*.* - - [18/Jun/2009:10:11:43 -0400] "=
GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-"=
"-"


*.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 200 2533148 "-" "-"
*.*.*.* - =
- [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew17.flv HTT=
P/1.1" 200 2533148 "-" "-"




It would seem like re-invited in the wheel if I were to implement R=
FC 2616 in perl when there is a byterange filter already present in apache.=
=A0 Thank you for any help!

-Adrian





--001636283644799f4b046ca02579--

Re: mp2 / Apache byterange filter

am 18.06.2009 16:56:22 von Jeff Trawick

--000e0cd24774795027046ca09c6c
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Thu, Jun 18, 2009 at 10:22 AM, Adriano Caloiaro wrote:

> Hello,
>
> Could someone point me in the correct direction to support byte range
> responses in mod_perl2? From what I've read, Apache should understand that
> it needs to apply the byterange filter whenever $r->sendfile is used on a
> large file and the Range: header is present in the incoming request.
> However what I'm seeing is that the entire file is returned for each byte
> range requested by the client.
>
> Access log serving off disk in Apache2:
>
> *.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 1 "-" "-"
> *.*.*.* - - [17/Jun/2009:19:50:31 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 435996 "-" "-"
> *.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 2097152 "-" "-"
>
> Serving from perl handler:
>
> *.*.*.* - - [18/Jun/2009:10:11:43 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
> *.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
> *.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET
> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
>

Maybe these checks are bypassing range processing? (httpd 2.2.x,
byterange_filter.c)

/* Iterate through the brigade until reaching EOS or a bucket with
* unknown length. */
for (e = APR_BRIGADE_FIRST(bb);
(e != APR_BRIGADE_SENTINEL(bb) && !APR_BUCKET_IS_EOS(e)
&& e->length != (apr_size_t)-1);
e = APR_BUCKET_NEXT(e)) {
clength += e->length;
}

/* Don't attempt to do byte range work if this brigade doesn't
* contain an EOS, or if any of the buckets has an unknown length;
* this avoids the cases where it is expensive to perform
* byteranging (i.e. may require arbitrary amounts of memory). */
if (!APR_BUCKET_IS_EOS(e) || clength <= 0) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}


>
>
> It would seem like re-invited in the wheel if I were to implement RFC 2616
> in perl when there is a byterange filter already present in apache. Thank
> you for any help!


See if these byterange requirements can be met. (Somebody that knows more
about mod_perl may have to check for you. It depends on how data is passed
to httpd.)

--000e0cd24774795027046ca09c6c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Thu, Jun 18, 2009 at 10:22 AM, Adriano Caloia=
ro <acaloiar@gma=
il.com
>
wrote:
border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; paddi=
ng-left: 1ex;">
Hello,

Could someone point me in the correct direction to support by=
te range responses in mod_perl2?=A0 From what I've read, Apache should =
understand that it needs to apply the byterange filter whenever $r->send=
file is used on a large file and the Range: header is present in the incomi=
ng request.=A0 However what I'm seeing is that the entire file is retur=
ned for each byte range requested by the client.=A0




Access log serving off disk in Apache2:

*.*.*.* - - [17/Jun/2009=
:19:50:30 -0400] "GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 20=
6 1 "-" "-"
*.*.*.* - - [17/Jun/2009:19:50:31 -0400]=
"GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 435996 "-=
" "-"



*.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 206 2097152 "-" "-"

Servin=
g from perl handler:

*.*.*.* - - [18/Jun/2009:10:11:43 -0400] "=
GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-"=
"-"



*.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 200 2533148 "-" "-"
*.*.*.* - =
- [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew17.flv HTT=
P/1.1" 200 2533148 "-" "-"




Maybe these checks are bypassing range processing?=A0=
(httpd 2.2.x, byterange_filter.c)

  =A0 /* Iterate through the =
brigade until reaching EOS or a bucket with
     * unknown lengt=
h. */
  =A0 for (e =3D APR_BRIGADE_FIRST(bb);

         (e !=3D APR_BRIGADE_SENTINEL(bb) && !APR_B=
UCKET_IS_EOS(e)
        =A0 && e->length !=3D=
(apr_size_t)-1);
         e =3D APR_BUCKET_NEXT(e)) { r>      =A0 clength +=3D e->length;
  =A0 }

=
  =A0 /* Don't attempt to do byte range work if this brigade doesn&=
#39;t

     * contain an EOS, or if any of the buckets has an unknown leng=
th;
     * this avoids the cases where it is expensive to perfor=
m
     * byteranging (i.e. may require arbitrary amounts of memo=
ry). */
  =A0 if (!APR_BUCKET_IS_EOS(e) || clength <=3D 0) {

      =A0 ap_remove_output_filter(f);
      =A0 =
return ap_pass_brigade(f->next, bb);
  =A0 }
=A0
ote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204=
); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


It would seem like re-invited in the wheel if I were to implement R=
FC 2616 in perl when there is a byterange filter already present in apache.=
=A0 Thank you for any help!


See if these byterange requirements can be met.=A0 (Somebody th=
at knows more about mod_perl may have to check for you.=A0 It depends on ho=
w data is passed to httpd.)



--000e0cd24774795027046ca09c6c--

Re: mp2 / Apache byterange filter

am 24.06.2009 17:15:33 von Adriano Caloiaro

--00163616403f4b09f7046d1995bd
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello mod_perlers,

According to the code supplied by Jeff, It appears that the only way the
byte range filter can be bypassed is when the content length is <= 0 or the
EOS is not in the brigade. I know that my content length is not zero, as it
specifically set in my test code. Is there a way to ensure that the EOS is
set on the brigade? This is the test handler that is not properly
acknowledging the Range: header:

sub handler {
my $r = shift;
$r->content_type('video/x-flv');
$r->set_content_length('2533148');
$r->sendfile('/var/www/perl/tmpfiles/mygcx/flvplayernew17.fl v');
return Apache2::Const::OK;
}

Can anyone point me in the right direction here? Thanks.

On Thu, Jun 18, 2009 at 10:56 AM, Jeff Trawick wrote:

> On Thu, Jun 18, 2009 at 10:22 AM, Adriano Caloiaro wrote:
>
>> Hello,
>>
>> Could someone point me in the correct direction to support byte range
>> responses in mod_perl2? From what I've read, Apache should understand that
>> it needs to apply the byterange filter whenever $r->sendfile is used on a
>> large file and the Range: header is present in the incoming request.
>> However what I'm seeing is that the entire file is returned for each byte
>> range requested by the client.
>>
>> Access log serving off disk in Apache2:
>>
>> *.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 1 "-" "-"
>> *.*.*.* - - [17/Jun/2009:19:50:31 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 435996 "-" "-"
>> *.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 2097152 "-" "-"
>>
>> Serving from perl handler:
>>
>> *.*.*.* - - [18/Jun/2009:10:11:43 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
>> *.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
>> *.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET
>> /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-" "-"
>>
>
> Maybe these checks are bypassing range processing? (httpd 2.2.x,
> byterange_filter.c)
>
> /* Iterate through the brigade until reaching EOS or a bucket with
> * unknown length. */
> for (e = APR_BRIGADE_FIRST(bb);
> (e != APR_BRIGADE_SENTINEL(bb) && !APR_BUCKET_IS_EOS(e)
> && e->length != (apr_size_t)-1);
> e = APR_BUCKET_NEXT(e)) {
> clength += e->length;
> }
>
> /* Don't attempt to do byte range work if this brigade doesn't
> * contain an EOS, or if any of the buckets has an unknown length;
> * this avoids the cases where it is expensive to perform
> * byteranging (i.e. may require arbitrary amounts of memory). */
> if (!APR_BUCKET_IS_EOS(e) || clength <= 0) {
> ap_remove_output_filter(f);
> return ap_pass_brigade(f->next, bb);
> }
>
>
>>
>>
>> It would seem like re-invited in the wheel if I were to implement RFC 2616
>> in perl when there is a byterange filter already present in apache. Thank
>> you for any help!
>
>
> See if these byterange requirements can be met. (Somebody that knows more
> about mod_perl may have to check for you. It depends on how data is passed
> to httpd.)
>
>

--00163616403f4b09f7046d1995bd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello mod_perlers,

According to the code supplied by Jeff, It appear=
s that the only way the byte range filter can be bypassed is when the conte=
nt length is <=3D 0 or the EOS is not in the brigade.=A0 I know that my =
content length is not zero, as it specifically set in my test code.=A0 Is t=
here a way to ensure that the EOS is set on the brigade?=A0 This is the tes=
t handler that is not properly acknowledging the Range: header:



sub handler {
    =A0 my $r =3D shift;
    =A0 $r=
->content_type('video/x-flv');
    =A0 $r->set_con=
tent_length('2533148');
    =A0 $r->sendfile('/va=
r/www/perl/tmpfiles/mygcx/flvplayernew17.flv');


    =A0 return Apache2::Const::OK;
=A0 }

Can anyone point=
me in the right direction here?=A0 Thanks.

e">On Thu, Jun 18, 2009 at 10:56 AM, Jeff Trawick < href=3D"mailto:trawick@gmail.com">trawick@gmail.com> wrote: r>

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
il_quote">
On Thu, Jun 18, 2009 at 10:22 AM, Adriano Caloi=
aro < blank">acaloiar@gmail.com> wrote:


204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,

Could someone point me in the correct direction to support by=
te range responses in mod_perl2?=A0 From what I've read, Apache should =
understand that it needs to apply the byterange filter whenever $r->send=
file is used on a large file and the Range: header is present in the incomi=
ng request.=A0 However what I'm seeing is that the entire file is retur=
ned for each byte range requested by the client.=A0






Access log serving off disk in Apache2:

*.*.*.* - - [17/Jun/2009=
:19:50:30 -0400] "GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 20=
6 1 "-" "-"
*.*.*.* - - [17/Jun/2009:19:50:31 -0400]=
"GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 206 435996 "-=
" "-"





*.*.*.* - - [17/Jun/2009:19:50:30 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 206 2097152 "-" "-"

Servin=
g from perl handler:

*.*.*.* - - [18/Jun/2009:10:11:43 -0400] "=
GET /mygcx/test/flvplayernew17.flv HTTP/1.1" 200 2533148 "-"=
"-"





*.*.*.* - - [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew=
17.flv HTTP/1.1" 200 2533148 "-" "-"
*.*.*.* - =
- [18/Jun/2009:10:11:45 -0400] "GET /mygcx/test/flvplayernew17.flv HTT=
P/1.1" 200 2533148 "-" "-"






Maybe these checks are bypassing range processi=
ng?=A0 (httpd 2.2.x, byterange_filter.c)

  =A0 /* Iterate throug=
h the brigade until reaching EOS or a bucket with
     * unknown=
length. */


  =A0 for (e =3D APR_BRIGADE_FIRST(bb);

         (e !=3D APR_BRIGADE_SENTINEL(bb) && !APR_B=
UCKET_IS_EOS(e)
        =A0 && e->length !=3D=
(apr_size_t)-1);
         e =3D APR_BUCKET_NEXT(e)) { r>      =A0 clength +=3D e->length;
  =A0 }



  =A0 /* Don't attempt to do byte range work if this brigade doesn&=
#39;t

     * contain an EOS, or if any of the buckets has an unknown leng=
th;
     * this avoids the cases where it is expensive to perfor=
m
     * byteranging (i.e. may require arbitrary amounts of memo=
ry). */
  =A0 if (!APR_BUCKET_IS_EOS(e) || clength <=3D 0) {



      =A0 ap_remove_output_filter(f);
      =A0 =
return ap_pass_brigade(f->next, bb);
  =A0 }
=A0
ss=3D"im">
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




It would seem like re-invited in the wheel if I were to implement R=
FC 2616 in perl when there is a byterange filter already present in apache.=
=A0 Thank you for any help!


See if these byterange requirements can be met.=A0 (Someb=
ody that knows more about mod_perl may have to check for you.=A0 It depends=
on how data is passed to httpd.)





--00163616403f4b09f7046d1995bd--